package com.sxt.sys.controller;

import java.util.ArrayList;
import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import com.sxt.sys.constast.SYSConstast;
import com.sxt.sys.domain.Menus;
import com.sxt.sys.domain.User;
import com.sxt.sys.service.MeService;
import com.sxt.sys.utils.DataGridView;
import com.sxt.sys.utils.TreeNode;
import com.sxt.sys.utils.WebUtils;
import com.sxt.sys.vo.MenusVo;

@Controller
@RequestMapping("menu")
public class MeController {
	@Autowired
	private MeService meService;
	
	/**
	 * 加载主页右边的导航树
	 */
	/*@RequestMapping("loadIndexLeftMenuTree")
	@ResponseBody
	public List<TreeNode> loadIndexLeftMenuTree(MeVo meVo){
		List<Me> me=null;
		User user=(User) WebUtils.getCurrentSession().getAttribute("user");
		if(user.getType()==SYSConstast.USER_TYPE_SUPER){
			me=this.meService.queryAllMenusForList(meVo);
		}else{
			me=this.meService.queryMenusByUserIdForList(meVo, user.getUserid());
		}
		List<TreeNode> treeNodes=new ArrayList<>();
		if(null!=me&&me.size()>0){
			for (Me menu : me) {
				Integer id=menu.getId();
				Integer pid=menu.getPid();
				String name=menu.getName();
				Boolean isParent=menu.getParent()==SYSConstast.MENUS_PARENT_TRUE?true:false;
				Boolean open=menu.getOpen()==SYSConstast.MENUS_OPEN_TRUE?true:false;
				String href=menu.getHref();
				String icon=menu.getIcon();
				String tabIcon=menu.getTabicon();
				treeNodes.add(new TreeNode(id, pid, name, isParent, open, href, icon, tabIcon));
			}
		}
		return treeNodes;
	}
	
	
	@RequestMapping("toMenuManager")
	public String toMenuManager(){
		return "system/menuManager";
	}
	*/
	
}
